f465a6b5891269c0061487f623c175d373856128,src/main/java/org/elasticsearch/indices/fielddata/cache/IndicesFieldDataCache.java,IndicesFieldDataCache,onRemoval,#RemovalNotification#,101

Before Change



    @Override
    public void onRemoval(RemovalNotification<Key, AtomicFieldData> notification) {
        if (notification.getKey() != null && notification.getKey().listener != null) {
            IndexFieldCache indexCache = notification.getKey().indexCache;
            long sizeInBytes = notification.getKey().sizeInBytes;
            if (sizeInBytes == -1 && notification.getValue() != null) {
                sizeInBytes = notification.getValue().getMemorySizeInBytes();
            }
            notification.getKey().listener.onUnload(indexCache.fieldNames, indexCache.fieldDataType, notification.wasEvicted(), sizeInBytes, notification.getValue());
        }
    }

After Change


        if (sizeInBytes == -1 && value != null) {
            sizeInBytes = value.getMemorySizeInBytes();
        }
        key.listener.onUnload(indexCache.fieldNames, indexCache.fieldDataType, notification.wasEvicted(), sizeInBytes, value);
    }

    public static class FieldDataWeigher implements Weigher<Key, AtomicFieldData> {